﻿<?php
@session_start();
require_once("../../class/mysql.class.php");

if ((isset($_GET["action"])) && ($_GET["action"] == "update"))
{               
  $obj = new Mysql();
  $obj -> set_table('user_login');
  $obj -> set_colone("(`*`)");
  $obj -> set_variables(" id_login = '" . $_SESSION["id"] . "' ");
  $user = $obj -> select_enregistrement();

	$id = $_REQUEST["id_monnaie"]; 
    $monnaie = addslashes($_REQUEST["monnaie"]); 
	$desc = addslashes($_REQUEST["desc_monnaie"]); 
	echo  $sql = "UPDATE `st_att_monnaie` SET `description`='".$desc."'  WHERE id_monnaie=".$id;
	$obj = new Mysql ();
	mysql_query($sql);
      header('location:../../list_monnaie.php?action=updated&devise='.$monnaie);	
}
elseif ((isset($_GET["action"])) && ($_GET["action"] == "delete"))
{

      if (empty($_GET['id_monnaie'])) 
      {
        header("Location:../user.php?action=error");
      } else 
      {
      $obj = new Mysql ();
      $requte="DELETE FROM `st_att_monnaie` WHERE `id_monnaie`='".$_GET["id_monnaie"]."'";
      $resultat=mysql_query($requte);
      header('location:../../list_monnaie.php?action=deleted');         
      }                 
      

}

?>